﻿@model View_SellerApply

@{
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@{
    var viewModel = Model ?? new View_SellerApply();
    ADZ_MasterEntities dbcontext = new ADZ_MasterEntities();
    Dictionary<string, string> dc = new Dictionary<string, string>();
}
<form id="S_Form" action="@Url.Action("SellerApplyInfo", "Account")" method="post" class="definewidth m20" enctype="multipart/form-data">
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td colspan="2" style="width:50%">
                <h5>
                    @ViewBag.Title,卖家申请信息
                </h5>
                <input type="hidden" value="@viewModel.seq_id" name="seq_id" />
            </td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">供应商类型<em></em></td>
            <td>
                <select id="supplier_type" name="supplier_type" multiple="multiple" size="10">
                    @{
                        dc = new Dictionary<string, string>();
                        var list = dbcontext.ADZ_SupplierType.ToList();
                        foreach (var item in list)
                        {
                            dc.Add(item.supplier_type.ToString(), item.supplier_type_name);
                        }
                    }
                    @HtmlPagerHelper.ShowSelectOpton(dc, viewModel.supplier_type.ToString())
                </select>
            </td>

            <td class="tableleft">
                分类<em></em><br />
                对于 windows：按住 Ctrl 按钮来选择多个选项<br />
                对于 Mac：按住 command 按钮来选择多个选项
            </td>
            <td>
                <select id="category_jsons" name="category_jsons" multiple="multiple" size="10">
                    @{
                        dc = new Dictionary<string, string>();
                        var goodsCategoryList = dbcontext.ADZ_GoodsCategory.Where(t => t.is_root == 1 && t.is_show == 1 && t.is_del == 0).ToList();

                        goodsCategoryList.ForEach(t =>
                        {
                            dc.Add(t.category_id.ToString(), t.category_name);
                        });

                        string[] selects = { "" };
                        if (!string.IsNullOrWhiteSpace(viewModel.category_json))
                        {
                            selects = viewModel.category_json.Split(',');
                        }
                    }
                    @HtmlPagerHelper.ShowSelectOpton(dc, selects)
                </select>
            </td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">联系人姓名<em></em></td>
            <td><input type="text" name="contact_name" maxlength="50" value="@viewModel.contact_name" /></td>

            <td width="10%" class="tableleft">联系电话<em></em></td>
            <td><input type="text" name="telephone" maxlength="50" value="@viewModel.telephone" /></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">email<em></em></td>
            <td><input type="text" name="email" maxlength="50" value="@viewModel.email" /></td>

            <td width="10%" class="tableleft">QQ<em></em></td>
            <td><input type="text" name="QQ" maxlength="50" value="@viewModel.qq" /></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">所属城市<em></em></td>
            <td>
                @{
                    var CityInfo1 = new CityInfoViewModel
                    {
                        DivID = "cityidaa1",
                        CityIDFormName = "company_cityid",
                        CityNameFormName = "company_cityname",
                        ShowDeep = 3,
                        CityID = @viewModel.company_cityid,
                        CityName = viewModel.company_cityname
                    };
                }
                @{Html.RenderPartial(Url.Content("~/Views/Common/CitySelect.cshtml"), CityInfo1);}
            </td>

            <td width="10%" class="tableleft">地址<em></em></td>
            <td><input type="text" name="company_address" maxlength="50" value="@viewModel.company_address" /></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">企业名称<em></em></td>
            <td><input type="text" name="company_name" maxlength="50" value="@viewModel.company_name" /></td>

            <td width="10%" class="tableleft">营业执照<em></em></td>
            <td>
                @{
                    OneImgModel oneImgModel = new OneImgModel();
                    oneImgModel.img_url = viewModel.company_img;
                    oneImgModel.showdel = true;
                    oneImgModel.remark = "上传营业执照";
                    oneImgModel.img_name = "company_img";
                    Html.RenderPartial(Url.Content("~/Views/Common/ImgsOneCommon.cshtml"), oneImgModel);
                }
            </td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td colspan="3">
                <p><span id="spMsg"></span></p>
                <button type="submit" class="btn btn-primary">保存</button> &nbsp;&nbsp;
                <button type="button" class="btn btn-success" name="backid" id="backid">返回</button>
            </td>

        </tr>
    </table>
    <script>
        BUI.use('bui/overlay', function (overlay) {
            $(function () {

                var rules = {

                };
                var messages = {
                    //'aDZ_GoodsMaster.goods_unit': { required: '售卖单位必选' },
                };

                var validator = $('form').validate({
                    errorLabelContainer: $("#errorContainer"),
                    errorElement: "span",
                    rules: rules,
                    messages: messages,
                    submitHandler: function (form) {
                        $(form).ajaxSubmit(function (result) {

                            ShowActionResult(result, function () { self.location = document.referrer; });//self.location = document.referrer;
                        });
                    }
                });

            });
        });
    </script>
</form>


